package com.neusoft.cebc.bv.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.neusoft.cebc.bv.ao.BrandAo;
import com.neusoft.cebc.bv.entity.BvBrand;
import com.neusoft.cebc.bv.function.BvBrandFunction;

@Controller
public class BrandManage {
	
	@Autowired
	private BvBrandFunction bvBrand;
	@RequestMapping("/addcommotity.do")
	public ModelAndView addCommodity(BrandAo ao) {
		ModelAndView model = new ModelAndView();
		try {
			BvBrand brand = bvBrand.addBrand(ao);
			if(brand != null) {
				model.addObject("BrandAo",brand);
				model.setViewName("index");
			}else {
				model.addObject("msg","添加品牌失败");
				model.setViewName("shibai");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return model;	
	}	
	
}
